<#assign ctx="${rc.contextPath}">

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <title>${Session.accTheme.accThemeTitle!"后台管理系统"}</title>
    <link type="image/x-icon" rel="shortcut icon" href="${ctx}/static/images/favicon.ico">
    <link type="text/css" rel="stylesheet" href="${ctx}/static/css/index.css"/>
</head>
<body>
<!-- 头部 -->
<div id="header" class="header">
    <a class="logo" href="/"><span class="logo-img">后台管理</span></a>
    <span class="logo-shadow"></span>

    <!-- 用户菜单栏 -->
    <div class="header-user-bar cf">
        <!-- 用户中心 -->
        <div class="header-menu">
            <a href="javascript:">
                <i class="icon-user"></i>欢迎您：${Session.currentUser.accUserName!}<b class="trangle trangle-b"></b>
            </a>
            <ul class="nav-list">
                <li><a href="/toChangePwd" target="contentPage"> <i class="icon-pwd"></i>修改密码 </a></li>
            </ul>
        </div>

        <!-- 常用页面 -->
        <div class="header-menu">
            <a href="javascript:"> <i class="icon-collect"></i>常用页面<b class="trangle trangle-b"></b> </a>
            <ul class="nav-list">
                <li>
                    <a href="${ctx}/kit/transfer/page/" target="contentPage"> <i class="icon-task-center"></i>转换工具 </a>
                </li>
            </ul>
        </div>

        <a class="header-link" href="${ctx}/logout"><i class="icon-exit"></i>退出</a>
    </div>
</div>

<div id="body" class="cf">
    <!-- 边栏 -->
    <div id="sidebar" class="main-side">
        <!-- 一级菜单 -->
        <div id="mainNav" class="main-nav">
            <ul class="main-menu"></ul>
            <a id="mainNavBtn" class="menu-slide-btn" href="javascript:void(0)"></a>
        </div>

        <!-- 二级菜单 -->
        <div id="subNav" class="sub-nav">
            <a id="subNavBtn" class="menu-slide-btn" href="javascript:void(0)"></a>
            <h4 id="subTitle" class="sub-nav-title"><i class="main-nav-icon icon-0"></i> 基础管理</h4>

            <div id="leftBar" class="sub-nav-bd"></div>
            <div class="sub-nav-ft"><b>&copy;</b>2015&nbsp;杨欢<br>版权所有</div>
        </div>

        <!-- 边栏折叠按钮 -->
        <a id="splitBar" class="split-bar" href="javascript:void(0)"> <b class="pillar"></b><i
                class="split-bar-icon"></i> </a>
    </div>

    <!-- 欢迎页面 -->
    <div id="welcome" class="welcome">
        <div class="welcome-arrow">欢迎使用 <span>"嘎子科技"</span> 后台管理系统</div>
    </div>

    <!-- 内容页面 -->
    <div id="mainContainer" class="main-container">
        <iframe src="" name="contentPage" id="contentPage" frameborder="0" width="100%" height="100%" scrolling="no"></iframe>
    </div>
</div>

<!-- 右键菜单 -->
<ul id="contextMenu" class="context-menu">
    <li id="newPageOpen"><a href="javascript:void(0);" target="_blank">新标签页打开</a></li>
    <li id="pageOpen"><a href="javascript:void(0);" target="contentPage">打开</a></li>
</ul>

<!-- loading弹框 -->
<div id="pageLoading" class="loading-box"><span class="page-loading">加载中，请稍候...</span></div>

<!-- 错误提示 -->
<div id="divMsg" class="alert">
    <button type="button" onclick="$('#divMsg').hide();" class="close" data-dismiss="alert"></button>
    <span>提示信息</span>
</div>

<!-- 滚动系统通知 -->
<!--
<div class="sys-notice">
    <div class="notice-wrap">
        <marquee direction="left" align="bottom" height="18" width="100%" onmouseout="this.start()" onmouseover="this.stop()" scrollamount="2" scrolldelay="1">
            <i class="icon-speaker"></i><span style="color: #f00;">系统公告：</span>10月22日 20:00 - 22:00 进行系统维护和升级，请在此期间停止系统业务操作，带来不便敬请谅解。
        </marquee>
    </div>
</div>
-->
<script type="text/javascript" src="${ctx}/static/js/jquery.min.js"></script>

<script type="text/javascript">
    $(function () {
        $.get('${ctx}/account/menu/first', function (data) {
            //生成一级导航
            var mainNavStr = '';
            data = JSON.parse(data);
            for (var i = 0; i < data.length; i++) {
                mainNavStr += '<li><a href="javascript:;" data-pid="' + data[i].accMenuId + '"><span class="icon-box">';
                mainNavStr += '<i class="main-nav-icon icon-' + i + '"></i></span>';
                mainNavStr += data[i].accMenuName + '</a></li>';
            }
            $("#mainNav").find(".main-menu").append(mainNavStr);

            //点击一级导航切换二级导航
            $("#mainNav").find(".main-menu").find('li').on('click', function () {
                var $this = $(this);
                navTitle($this);

                //一级导航添加高亮并隐藏
                $this.addClass("current").siblings().removeClass("current");
                $("#mainNav").hide();
                $("#subNav").show();

                //生成二级导航
                var pid = $this.find('a').data('pid');
                $.get('${ctx}/account/menu/second?id=' + pid, function (data) {
                    var subWrap = $('#sub-' + pid);
                    createSubNav(data, subWrap, pid);
                });
            });

            //新标签打开页面时,获取url里的参数，并在页面初始化时进入二级菜单
            var urlStr = GetQueryString("menu_mark");
            if (urlStr) {
                var p = urlStr.split('/');
                $('#mainNav, #welcome').hide();
                $('#subNav, #mainContainer, #splitBar').show();

                $.get('${ctx}/account/menu/second?id=' + p[0], function (data) {
                    var subWrap = $('#sub-' + p[0]);
                    createSubNav(data, subWrap, p[0]);

                    //一级导航高亮选中
                    $('#mainNav').find('li').each(function () {
                        var aPid = $(this).find('a').data('pid');
                        if (aPid == p[0]) {
                            $(this).addClass('current');
                            navTitle($(this));
                        }
                    });

                    //展开二级菜单并选中链接
                    var panelBd = $('#sub-' + p[0]).find('.accordion-panel').eq(p[1]).find('.accordion-bd');
                    var pageUrl = panelBd.find('li').eq(p[2]).find('a').attr('href');
                    panelBd.show();
                    panelBd.find('li').eq(p[2]).addClass('current');
                    $('#contentPage').attr('src', pageUrl);
                });
            }
        });
    });
</script>

<!-- 右下角消息弹出框js库 -->
<#--<%--<script type="text/javascript" src="${ctx}/static/js/jquery-plugin/jquery.messager.js"></script>--%>-->
<script type="text/javascript" src="${ctx}/static/js/jquery.nicescroll.min.js"></script>
<script type="text/javascript" src="${ctx}/static/js/index.js"></script>
</body>
</html>